{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "352a227d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pybedtools import BedTool\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3ea1a1a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "### inputs \n",
    "chrom=\"chr21\"\n",
    "vcf_path=\"/lustre/scratch126/humgen/projects/interval_wgs/final_release_freeze/all_unphased/interval_wgs.chr21.all_unphased.vcf.gz\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "80141770",
   "metadata": {},
   "outputs": [],
   "source": [
    "vcf_bed = BedTool(vcf_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a273de1b",
   "metadata": {},
   "outputs": [],
   "source": [
    "test_gene = \"chr21 5614800 5614880 ENSG00000274333 0 +\"\n",
    "test_gene_bed = BedTool(test_gene, from_string=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e45ab6a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "genes_bed_path=\"/lustre/scratch126/humgen/projects/interval_rna/interval_rna_seq/thomasVDS/misexpression/4_vrnt_enrich/1_snp_indel/4554smpls_8793genes/genes_bed/chr21_genes_test_1_gene.bed\"\n",
    "genes_bed = BedTool(genes_bed_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "49b11eff",
   "metadata": {},
   "outputs": [],
   "source": [
    "test_gene_bed.window(vcf_bed, w=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d331ae87",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
